<div class="widget">
	<div class="widget-header bg-blue">
		<i class="widget-icon icon-notebook"></i> 
		<span class="widget-caption"> 机构注册 </span>
		<div class="widget-buttons">
			<a href="javascript:void(0);" onclick="handlerCancel(this);" title="关闭"
				 data-toggle="dispose" data-refresh-table="#table-center"> <i class="fa fa-times"></i> </a> 
		</div>
	</div>
	<div class="widget-body">
		<!-- TODO 基本信息 -->
		<div class="widget radius-bordered">
			<div class="widget-header">
				<i class="widget-icon icon-notebook"></i> 
				<span class="widget-caption"> 基本信息 </span>
			</div>
			<div class="widget-body editor-body-sm">
				<form class="form-horizontal form-editor form-editor-center">
					<div class="row">
						<div class="col-sm-4">
							<div class="form-group">
								<label class="col-sm-4 control-label" for="type">机构类型</label>
								<div class="col-sm-8">
									<select name="type" id="type" class="chosen-select" data-entity="com.app.miwawa.api.system.entity.config.Codec">
									</select>
								</div>
							</div>
						</div>
						<div class="col-sm-4">
							<div class="form-group">
								<label class="col-sm-4 control-label required" for="name">机构名称</label>
								<div class="col-sm-8">
									<input name="name" id="name" type="text" class="form-control" required="required">
								</div>
							</div>
						</div>
						<div class="col-sm-4">
							<div class="form-group">
								<label class="col-sm-4 control-label" for="code">机构编码</label>
								<div class="col-sm-8">
									<input name="code" id="code" type="text" class="form-control" readonly="readonly">
								</div>
							</div>
						</div>
					</div>
					<div class="row">
						<div class="col-sm-4">
							<div class="form-group">
								<label class="col-sm-4 control-label" for="brand">品牌</label>
								<div class="col-sm-8">
									<input type="text" name="brand" id="brand" class="form-control" value="蜜娃娃" readonly="readonly"/>
								</div>
							</div>
						</div>
						<div class="col-sm-4">
							<div class="form-group">
								<label class="col-sm-4 control-label" for="director">负责人</label>
								<div class="col-sm-8">
									<input type="text" name="director" id="director" class="form-control" />
								</div>
							</div>
						</div>
						<div class="col-sm-4">
							<div class="form-group">
								<label class="col-sm-4 control-label" for="mobile">手机</label>
								<div class="col-sm-8">
									<input name="mobile" id="mobile" type="text" class="form-control"> 
								</div>
							</div>
						</div>
					</div>
					<div class="row">
						<div class="col-sm-4">
							<div class="form-group">
								<label class="col-sm-4 control-label" for="dburl">数据源地址</label>
								<div class="col-sm-8">
									<input type="text" name="dburl" id="dburl" class="form-control" />
								</div>
							</div>
						</div>
						<div class="col-sm-4">
							<div class="form-group">
								<label class="col-sm-4 control-label required" for="dbname">数据源名称</label>
								<div class="col-sm-8">
									<input type="text" name="dbname" id="dbname" class="form-control" required="required"/>
								</div>
							</div>
						</div>
						<div class="col-sm-4">
							<div class="form-group">
								<label class="col-sm-4 control-label" for="createDate">注册时间</label>
								<div class="col-sm-8">
									<div class="input-group date date-selector">
										<input name="createDate" id="createDate" type="text" class="form-control"> 
										<span class="input-group-addon">
											<span class="fa fa-calendar"></span>
										</span>
									</div>
								</div>
							</div>
						</div>
					</div>

					<div class="widget-footer editor-footer-sm">
						<button type="button" class="btn btn-danger btn-sm" data-toggle="tooltip" data-placement="top" title="取消" onclick="handlerCancel(this);" data-refresh-table="#table-center">
							<i class="glyphicon glyphicon-remove"></i>
						</button>
						<button type="button" class="btn btn-primary btn-sm" data-toggle="tooltip" data-placement="top" title="保存" onclick="handlerSubmit(this, '#editor-form-center', '.form-editor-center', 'prompt');" data-submit-callback="hiddened">
							<i class="glyphicon glyphicon-ok"></i>
						</button>
					</div>
				</form>
			</div>
		</div>
		
		<!-- TODO 校区信息 -->
		<div class="widget radius-bordered hidden" id="editor-panel-region">
			<div class="widget-header">
				<i class="widget-icon icon-notebook"></i> 
				<span class="widget-caption"> 校区信息 </span>
				<div class="widget-buttons buttons-bordered">
					<button class="btn btn-default btn-sm" title="添加" 
									data-toggle="tooltip" data-placement="top" 
									data-tool="append" 
									data-template-id="#form-region-template" 
									data-template-path="/miwawa/content/system/center/template.html" 
									data-template-target=".editor-body-region"
									data-loaded="onRegionEditorLoaded">
						<i class="fa fa-plus"></i>
					</button>
					<button class="btn btn-default btn-sm" title="删除" 
									data-toggle="tooltip" data-placement="top" 
									data-tool="remove" data-template-target=".editor-body-region">
						<i class="fa fa-minus"></i>
					</button>
				</div>
			</div>
			<div class="widget-body editor-body-sm editor-body-region">
				<form class="form-horizontal form-editor form-editor-region">
					<div class="row">
						<div class="col-sm-4">
							<div class="form-group">
								<label class="col-sm-4 control-label required" for="name">校区名称</label>
								<div class="col-sm-8">
									<input name="name" id="name" type="text" class="form-control" required="required">
								</div>
							</div>
						</div>
						<div class="col-sm-2">
							<div class="form-group">
								<div class="col-sm-12">
									<div class="input-group">
										<select name="prov" id="prov" class="chosen-select">
											<option value="310000">上海</option>
										</select> 
										<span class="input-group-addon">省</span>
									</div>
								</div>
							</div>
						</div>
						<div class="col-sm-3">
							<div class="form-group">
								<div class="col-sm-12">
									<div class="input-group">
										<select name="pref" id="pref" class="chosen-select">
											<option value="310100">上海</option>
										</select> 
										<span class="input-group-addon">市</span>
									</div>
								</div>
							</div>
						</div>
						<div class="col-sm-3">
							<div class="form-group">
								<div class="col-sm-12">
									<div class="input-group">
										<select name="county" id="county" class="chosen-select">
										</select> 
										<span class="input-group-addon">区县</span>
									</div>
								</div>
							</div>
						</div>
					</div>

					<div class="widget-footer editor-footer-sm">
						<button type="button" class="btn btn-danger btn-sm" data-toggle="tooltip" data-placement="top" title="取消" onclick="handlerCancel(this);" data-refresh-table="#table-center">
							<i class="glyphicon glyphicon-remove"></i>
						</button>
						<button type="button" class="btn btn-primary btn-sm" data-toggle="tooltip" data-placement="top" title="保存" onclick="handlerSubmit(this, '#editor-form-region', '.form-editor-region');">
							<i class="glyphicon glyphicon-ok"></i>
						</button>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>

<!-- 提交表单 ========================================================= -->
<form id="editor-form-center" action="/miwawa/system/center/save" method="post" 
			name="com.app.miwawa.api.system.entity.Center" 
			data-show-target="#editor-panel-region" data-custom-action="true">
			<input type="hidden" name="status" value="0">
			<input type="hidden" name="invalid" value="F">
</form>
<form id="editor-form-region" action="/miwawa/default/common/save" method="post" 
			name="com.app.miwawa.api.system.entity.Region"
			data-foreign-src="#editor-form-center" 
			data-foreign-key="com.app.miwawa.api.system.entity.Center">
			<input type="hidden" name="bean['status']" value="0">
			<input type="hidden" name="bean['invalid']" value="F">
			<input type="hidden" name="bean['centerid']" data-foreign-id>
</form>
    
<script type="text/javascript">
	jQuery(function() {
		require(['jquery.plugin.form'],function(form){
			form.chosen('.chosen-select');
			form.region("#county",{"pid":"310100"});
			form.select("#type",{
				url:"/miwawa/default/common/select.json",
				querys: {"pcode_EQ": "c_organ_type"}
			});
			form.datepicker('.date-selector');
			form.tooltip("[data-toggle='tooltip']");
		});
	});
	
	function onRegionEditorLoaded(){
		require(['jquery.plugin.form'],function(form){
			form.region("#county",{"pid":"310100"});
			form.chosen('.chosen-select');
			form.tooltip("[data-toggle='tooltip']");
		});
	}
	
	function prompt(){
		jQuery.utils.loading("正在提交数据，请稍后...", "show");
	}
	
	function hiddened(){
		jQuery.utils.loading(null, "hide");
	}
	
	
</script>